<template>
  <div class="basinInfo">
    <card :title="`${infoList[0].pn_typecn}列表（${infoList.length}）`">
      <div class="inputBox">
        <div class="item">
          <div class="lable">筛选</div>
          <el-input v-model="dialogFrom.name" placeholder="全部"></el-input>
        </div>
        <div class="item">
          <div class="lable">排序</div>
          <el-input v-model="dialogFrom.name" placeholder="排序"></el-input>
        </div>
      </div>
    </card>
    <div class="details">
      <div @click="handleItem(item)" class="reslutList" v-for="(item, index) in infoList" :key="item.id">
        <div>{{ index + 1 }}</div>
        <div>
          <div>{{ item.pn_name }}</div>
          <div>{{ item.field31 || item.field57 }}</div>
        </div>
        <div>
          <img src="@/assets/image/icon/dw.svg" alt="" />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import card from "@/components/panel/card.vue"
export default {
  components: { card },
  props: {
    panelDetail: {
      type: Object,
      default: () => ({}),
    },
  },

  data() {
    return {
      dialogFrom: {
        name: "",
        filter: "",
      },
    }
  },
  // computed: {
  //   infoList() {
  //     console.log(this.panelDetail);
  //     return this.panelDetail.data;
  //   },
  // },

  watch: {
    panelDetail: {
      handler(newValue, oldValue) {
        this.infoList = newValue?.data
      },
      deep: true,
      immediate: true,
    },
  },
  mounted() {
    console.log(this.panelDetail)
  },
  methods: {
    handleItem(item) {
      this.$Bus.$emit("handleList", item)
    },
  },
}
</script>
<style lang="scss" scoped>
.basinInfo {
  height: 100%;
  .inputBox {
    padding: 0px 15px 10px 15px;
    .item {
      //   display: flex;
      margin: 8px;
      align-items: center;
      .lable {
        font-size: 16px;
        text-align: left;
        line-height: 35px;
      }
    }
  }
  .details {
    width: 98%;
    height: calc(100% - 250px);
    border-radius: 0px 0px 8px 8px;
    margin: 8px auto;
    background: #fff;
    overflow: auto;
    .reslutList {
      padding: 5px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      box-sizing: border-box;
      cursor: pointer;
      &:nth-child(2n) {
        background: rgba(131, 150, 181, 0.1);
      }
      &:hover {
        background: rgba(131, 150, 181, 0.2);
      }
      > :nth-child(1),
      :nth-child(3) {
        flex: 1;
        font-size: 18px;
        > img {
          width: 22px;
          height: 22px;
        }
      }
      > :nth-child(2) {
        flex: 3;
        text-align: left;
        > :nth-child(1) {
          font-weight: bold;
          color: rgba(0, 20, 45, 0.8);
          font-size: 16px;
          line-height: 26px;
        }
        > :nth-child(2) {
          color: rgba(0, 20, 45, 0.6);
          font-size: 16px;
        }
      }
    }
  }
}
</style>
